#!/bin/bash

pwd

export PATH=$PATH:/home/robert/servers/apache-maven-2.2.1/bin/:/home/robert/jdk1.6.0_16/bin
export JAVA_HOME=/home/robert/jdk1.6.0_16
export MAVEN_HOME=/home/robert/servers/apache-maven-2.2.1

current_date=`date +"%d-%m-%Y__%H:%M"`
new_dir="build_"$current_date
svn checkout http://java-spring.googlecode.com/svn/trunk/hotel hotel

cd hotel

mvn clean install

#copy built war file
mkdir /var/hudson/builds/$new_dir
cp target/hotel.war /var/hudson/builds/$new_dir/

mvn tomcat:undeploy
mvn tomcat:deploy

